import { MedicineItem } from '@/interfaces/medicine'
import type { ProColumns } from '@ant-design/pro-components';


const getColumns: () => ProColumns<MedicineItem>[] = () => {
    return [
        {
            title: '药品名称',
            dataIndex: 'name',
            hideInSearch: true
        },
        {
            title: '生产厂家',
            dataIndex: 'factory',
        },
        {
            title: '规格',
            dataIndex: 'specs',
            hideInSearch: true
        },
        {
            title: '剂型',
            dataIndex: 'type',
            hideInSearch: true
        },
        {
            title: '包装',
            dataIndex: 'pack',
            hideInSearch: true
        },
        {
            title: '单价',
            dataIndex: 'price',
            hideInSearch: true
        },
        {
            title: '库存',
            dataIndex: 'entercount',
            hideInSearch: true
        },
        {
            title: '总金额',
            dataIndex: 'totalprice',
            hideInSearch: true
        },
        {
            title: '生产批号',
            dataIndex: 'batchnumber',
        },
        {
            title: '生产日期',
            dataIndex: 'productdate',
            valueType: 'date',
            sorter: true,
            hideInSearch: true,
        },
        {
            title: '生产日期',
            dataIndex: 'productdate',
            valueType: 'dateRange',
            hideInTable: true,
            search: {
                transform: (value) => {
                    return {
                        productStartDate: value[0],
                        productEndDate: value[1],
                    };
                },
            },
        },
        {
            title: '有效截止日期',
            dataIndex: 'deaddate',
            valueType: 'date',
            sorter: true,
            hideInSearch: true,
        },
        {
            title: '有效截止日期',
            dataIndex: 'deaddate',
            valueType: 'dateRange',
            hideInTable: true,
            search: {
                transform: (value) => {
                    return {
                        deadStartDate: value[0],
                        deadEndDate: value[1],
                    };
                },
            },
        },
    ];
}

export default getColumns;